package com.ruoyi.web.controller.address;

import com.ruoyi.address.domain.vo.ResolutionAddressVo;
import com.ruoyi.address.service.IChinaAreaService;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @author lisongtao
 * @date 2023/6/27 22:21
 */
@RestController
public class ChinaAreaController {


    @Autowired
    private IChinaAreaService chinaAreaService;

    @PostMapping("/getRegions")
    public AjaxResult getRegions() {
        return AjaxResult.success(chinaAreaService.getChinaAreaWeChats());
    }

    /**
     * 获取地区 级联选择器
     */
    @PostMapping("/getRegionsForCascader")
    public AjaxResult getRegionsForCascader() {
        return AjaxResult.success(chinaAreaService.getChinaCascadeVos());
    }

    /**
     * 解析地址
     */
    @PostMapping("/resolutionAddress")
    public AjaxResult resolutionAddress(@RequestBody ResolutionAddressVo resolutionAddressVo) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.put("addressResultVo", chinaAreaService.resolutionAddress(resolutionAddressVo));
        return ajaxResult;
    }





}
